<!--根据这个页单独设置样式-->
<style>
    .table-responsive{overflow-x: inherit}
    td{ vertical-align: middle!important;}
    .pagination{ margin:0!important;}
    .flot{float: left}
    .rlot{float: right}
</style>
<div>
    <div class="bg-light lter b-b wrapper-md">
        <h1 class="m-n font-thin h3">商品列表</h1>
    </div>
    <div class="padder-md m-b-none m-t" style="padding-top: 0">
        <div class="panel panel-default">
            <div class="panel-heading">商品列表</div>
            <div class="m-sm">
                <div class="clearfix">
                    <div class="row wrapper" style="padding-bottom:0;">
                        <div class="col-sm-3 col-md-2 col-lg-2">
                            <input class="form-control ng-pristine ng-untouched ng-valid"
                                   ng-model="ctrl.vm.search.id" type="text" placeholder="商品id" >
                        </div>
                        <div class="col-sm-3 col-md-2 col-lg-2">
                            <input class="form-control ng-pristine ng-untouched ng-valid"
                                   ng-model="ctrl.vm.search.name" type="text" placeholder="名字" >
                        </div>
                        <div class="col-sm-3 col-md-2 col-lg-2">
                            <select class="form-control" ng-model="ctrl.vm.search.state">
                                <option value="">状态</option>
                                <option value="1">启用</option>
                                <option value="0">禁用</option>
                            </select>
                        </div>
                        <div class="col-sm-3 col-md-2 col-lg-2">
                            <select class="form-control" ng-model="ctrl.vm.search.see">
                                <option value="">是否搜索可见</option>
                                <option value="1">可见</option>
                                <option value="0">不可见</option>
                            </select>
                        </div>
                        <div class="col-sm-3 col-md-2 col-lg-2">
                            <p class="input-group">
                                <span style="display: inline-block;float:left;padding-top: 5px;">是否显示图片 </span>
                                <label class="i-switch m-t-xs m-r">
                                    <input type="checkbox" ng-click="ctrl.vm.changeImg()" ng-model="ctrl.vm.search.seeImg" >
                                    <i></i>
                                </label>
                            </p>
                        </div>
                        <div class="col-sm-3 col-md-2 col-lg-2">
                            <div>
                                <button class="btn btn-sm btn-default" type="button" ng-click="ctrl.vm.searchFn()">搜索</button>
                                <button class="btn btn-sm btn-dark" type="button" ng-click="ctrl.vm.reset()">重置</button>
                            </div>
                        </div>
                    </div>
                   <!-- <div style="width: 100%" class="pull-right text-right">
                        <div>
                            <button class="btn btn-sm btn-default" type="button" ng-click="ctrl.vm.searchFn()">搜索</button>
                            <button class="btn btn-sm btn-dark" type="button" ng-click="ctrl.vm.reset()">重置</button>
                        </div>
                    </div>-->
                </div>
            </div>
            <div class="table-responsive" style="padding: 0 15px">
                <table class="table table-striped b-t b-light">
                    <thead>
                    <tr>
                        <th>id</th>
                        <th width="20%">名字</th>
                        <th ng-if="ctrl.vm.search.seeImg==true" >图片</th>
                        <th >选项</th>
                        <th>时间</th>
                        <th>状态</th>
                        <th>搜索可见</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="data in ctrl.vm.data" style="width: 100%">
                        <td style="width: 5%">{{data.base.id}}</td>
                        <td>{{data.base.name}}</td>
                        <td ng-if="ctrl.vm.search.seeImg==true" style="width: 30%">
                            <div >
                                <div style="width: 30%;margin: 4px;float: left" >
                                    <img ng-if="data.images.length>=1" ng-src="{{data.images[0].url | imgwhq:150:300:90}}"style="width: 100%;height: 100%">
                                </div>
                                <div style="width: 30%;margin: 4px;float: left" >
                                    <img ng-if="data.images.length>=2" ng-src="{{data.images[1].url | imgwhq:150:300:90}}"style="width: 100%;height: 100%">
                                </div>
                                <div style="width: 30%;margin: 4px;float: left" >
                                    <img ng-if="data.images.length>=3" ng-src="{{data.images[2].url | imgwhq:150:300:90}}"style="width: 100%;height: 100%">
                                </div>
                            </div>
                        </td>
                        <td style="width: 10%">
                            <div ng-repeat="item in data.product_stock">
                                <span ng-if="item.attr_value_name">{{item.attr_value_name}}</span><span ng-if="!item.attr_value_name">无</span>  - <span ng-if="item.price">{{item.price|number:2|currency : '$'}}</span><span ng-if="!item.price">无</span>
                            </div>
                        </td>
                        <td style="width: 10%">{{data.base.created_at}}</td>
                        <td style="width: 5%">
                            <span class="label bg-success" ng-if="data.base.status==1">启用</span>
                            <span class="label bg-danger" ng-if="data.base.status==0">禁用</span>
                        </td>
                        <td style="width: 8%">
                            <span class="label bg-info" ng-if="data.base.is_search==1">可见</span>
                            <span class="label bg-dark" ng-if="data.base.is_search==0">不可见</span>
                        </td>
                        <td style="width: 5%">
                            <div class="btn-group">
                                <a class="btn btn-sm btn-primary" ng-click="ctrl.vm.edit(data.base.id)" >编辑</a>
                            </div>
                        </td>
                    </tr>
                    <tr ng-if="!ctrl.vm.data.length">
                        <td colspan="12" class="text-center">暂无数据！</td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <footer class="panel-footer">
                <div class="row">
                    <div class="col-sm-2 hidden-xs">
                        <select
                                class="input-sm form-control w-sm inline v-middle"
                                ng-model="placement.selected"
                                ng-options="o as o for o in placement.options"
                                ng-change="placement.changeFn()"
                        >
                        </select>
                        <i style="float: right;padding: 2% 15% 0 0">总计{{vm.page.total}}</i>
                    </div>
                    <div class="col-sm-10 text-right text-center-xs">
                        <div class="pagination pagination-sm m-t-none m-b-none">
                            <uib-pagination
                                    boundary-links="true"
                                    total-items="vm.page.total"
                                    max-size="placement.pageSize"
                                    items-per-page="placement.selected"
                                    ng-model="vm.page.current_page"
                                    ng-change="pageChanged()"
                                    class="pagination-sm"
                                    previous-text="&lsaquo;"
                                    next-text="&rsaquo;"
                                    first-text="&laquo;"
                                    last-text="&raquo;"
                            >
                            </uib-pagination>
                        </div>
                    </div>
                </div>
            </footer>
        </div>
    </div>
</div>